package BehavioralPattern.Memento;

import lombok.Data;


/**
 * @Classname : Originator
 * @Description : 发起人角色
 * @Author : chentianyu
 * @Date 2023/3/8 20:59
 */

@Data
public class Originator {

    private String state1;
    private String state2;
    private String state3;

    public Memento createMemento() {
        return new Memento(BeanUtils.backupProp(this));
    }

    public void restoreMemento(Memento memento) {
        BeanUtils.restoreProp(this, memento.getStateMap());
    }

}
